
import java.util.Stack;

/**
 * @Author 12629
 * @Description：
 */
public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        binaryTree.preOrder(root);
        System.out.println();
        //非递归实现！
        binaryTree.preOrderNor(root);
        System.out.println();
        System.out.println("=======================");

        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.inOrderNor(root);
        System.out.println();
        System.out.println("============上面是中序遍历===========");

        binaryTree.postOrder(root);
        System.out.println();
        binaryTree.postOrderNor(root);
        System.out.println();
        System.out.println("============上面是后序遍历===========");


        System.out.println("节点的个数: ");
        binaryTree.size(root);
        System.out.println(BinaryTree.usedSize);
        System.out.println("叶子节点的个数：");
        binaryTree.getLeafNodeCount(root);
        System.out.println(BinaryTree.leafSize);
        System.out.println("==========");
        System.out.println(binaryTree.getLeafNodeCount2(root));
        System.out.println("======第K层的节点个数========");
        System.out.println(binaryTree.getKLevelNodeCount(root, 4));
        System.out.println("======树的高度========");
        System.out.println(binaryTree.getHeight(root));
        System.out.println(binaryTree.getHeight2(root));
        System.out.println("======查找========");
        BinaryTree.TreeNode ret = binaryTree.find(root,'E');
        System.out.println(ret.val);
        System.out.println("层序遍历：");
        binaryTree.levelOrder(root);
        System.out.println();
        System.out.println("是否是完全二叉树：");
        System.out.println(binaryTree.isCompleteTree(root));
        System.out.println("====获取路径====");
        Stack<BinaryTree.TreeNode> stack = new Stack<>();
        binaryTree.getPath(root,root.left.right,stack);
    }
}
